package com.xls.box2023.jinbi.jifenduihuanjilu;


import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.xls.box2023.Consts.IntentConsts;
import com.xls.box2023.R;
import com.xls.box2023.mvp.MVPBaseActivity;
import com.xls.xrecyclerview.XRecyclerView;

import androidx.recyclerview.widget.LinearLayoutManager;


/**
 * MVPPlugin
 */

public class JiFenDuiHuanJiLuActivity extends MVPBaseActivity<JiFenDuiHuanJiLuContract.View, JiFenDuiHuanJiLuPresenter> implements JiFenDuiHuanJiLuContract.View, View.OnClickListener {

    private TextView title_text;
    private TextView title_back;
    private RelativeLayout title_rl_content;
    private XRecyclerView jifenduihuanjinbijilu_list;

    /**
     * 统一传递参数
     * @param activity
     */
//    public static void startActivity(Context activity) {
//        Intent intent=new Intent(activity,JiFenDuiHuanJiLuActivity.class);
//        activity.startActivity(intent);
//    }

    public static void startActivity(Context activity,String appid, String type) {
        Intent intent=new Intent(activity,JiFenDuiHuanJiLuActivity.class);
        intent.putExtra(IntentConsts.data,appid);
        intent.putExtra(IntentConsts.type,type);
        activity.startActivity(intent);
    }

    @Override
    public int getView() {
        return R.layout.activity_jifenduihuanjilu;
    }

    @Override
    public void initView() {

        title_text = findViewById(R.id.title_text);
        title_back = findViewById(R.id.title_back);
        title_rl_content = findViewById(R.id.title_rl_content);
        jifenduihuanjinbijilu_list = findViewById(R.id.jifenduihuanjinbijilu_list);
        title_back.setOnClickListener(this);
        title_text.setText("元宝兑换明细");
        setAdapter();
    }

    private void setAdapter() {
        jifenduihuanjinbijilu_list.setLayoutManager(new LinearLayoutManager(this));
        jifenduihuanjinbijilu_list.setAdapter(mPresenter.getAdapter());
        jifenduihuanjinbijilu_list.setLoadingListener(mPresenter.getLoadingListener());
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.title_back) {
            finish();
        }
    }

    @Override
    public XRecyclerView getListView() {
        return jifenduihuanjinbijilu_list;
    }
}
